CREATE FUNCTION myEncryptDecryptString ( @pClearString VARCHAR(MAX) )
RETURNS NVARCHAR(MAX) WITH ENCRYPTION AS
BEGIN
	DECLARE @vEncryptedString NVARCHAR(100)
	DECLARE @vIdx INT
	DECLARE @vBaseIncrement INT
	SET @vIdx = 1
	SET @vBaseIncrement = 100
	SET @vEncryptedString = ''
	WHILE @vIdx <= LEN(@pClearString)
	BEGIN
		SET @vEncryptedString = @vEncryptedString + NCHAR(ASCII( SUBSTRING(@pClearString, @vIdx, 1)) ^ @vBaseIncrement)
		SET @vIdx = @vIdx + 1
	END
RETURN @vEncryptedString
END
GO